package com.schx.budget.mapper;

import com.schx.budget.pojo.Account;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Classname LoginMapper
 * @Description TODO
 * @Date 2021/2/5 10:26
 * @Created by cyh
 */
public interface LoginMapper {



    @Results(id="loginMsg",
            value = {
                    @Result(property = "password", column = "PASSWORD"),
                    @Result(property = "userCount", column = "USERCOUNT"),
                    @Result(property = "orgName", column = "ORG_SHORT_NAME")})
    @Select("select password,org_short_name，usercount from budget_account where org_id=#{orgid}")
    Account getAccount(Integer orgid);

    @Update("update budget_account set password=#{newPassword} where org_id=#{orgid} ")
    int editPassword(@Param("orgid") Integer orgid, @Param("newPassword")String newPassword);

    @Results(id="listAccount",
            value = {
                    @Result(property = "orgid", column = "ORG_ID"),
                    @Result(property = "userCount", column = "USERCOUNT"),
                    @Result(property = "orgName", column = "ORG_SHORT_NAME")})
    @Select("select org_id,org_short_name,usercount from budget_account where org_id != 1001")
    List<Account> listOrg();
}
